<%@ page language="java" contentType="text/html;charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>

<div id="wrapsignup">
	<div id="wrapsignuptop"></div>
	<div id="wrapsignupmiddle">
		<h2>가입하기</h2><br/>
		<form id="signup_form">
			<input type="email" id="signup_account" placeholder="계정(Email)" required autofocus><br/>
			<input type="text" id="signup_name" placeholder="도서관 이름" required><br/>
			<input type="password" id="signup_password" placeholder="비밀번호" required><br/>
			<input type="submit" id="signup_submit" value="가입하기">
		</form>
	</div>
	<div id="wrapsignupbottom"></div>
</div>
<c:if test="${!empty message}">
	<div id="wrapsignupmsg">${message}</div>
</c:if>

<script>
	$(document).ready(function() {
		$('#signup_account').focus();
	});
	
	$('#signup_form').submit(function() {
		$.ajax({
			url : 'signup.action',
			type : 'POST',
			data : {
				account : $('#signup_account').val(),
				name : $('#signup_name').val(),
				password : $('#signup_password').val()
			},
			dataType : 'html',
			success : function(html) {
				$('#wrapadd').html(html);
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
		return false;
	});
</script>
